﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for CategoryDetailAdapter
/// </summary>
public class CategoryDetailAdapter
{
	public CategoryDetailAdapter()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public long insertCategoryDetail(CategoryDetailEntity newCategory)
    {
        BookContextDataContext bookContext = new BookContextDataContext();
        try
        {
                CategoryDetail tmpCategoryDetail = new CategoryDetail();
                tmpCategoryDetail.CategoryID = newCategory.CategoryID;
                tmpCategoryDetail.PlatformID = newCategory.PlatformID;

                bookContext.CategoryDetails.InsertOnSubmit(tmpCategoryDetail);
                bookContext.SubmitChanges();

            return tmpCategoryDetail.ID;
        }
        catch
        {
            return 0;
        }
    }
}